package org.example.memberlist_back.controller;

import org.example.memberlist_back.common.Login;
import org.example.memberlist_back.common.Res;
import org.example.memberlist_back.entity.Member;
import org.example.memberlist_back.server.LoginServer;
import org.example.memberlist_back.server.LoginServerImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
public class LoginController {
    @Autowired
    private LoginServer loginServer;
    @PostMapping("/login")
    public Res<Member> login(@RequestBody Login login){

        return loginServer.login(login.getUsername(),login.getPassword());
    }
}
